from django.utils.deprecation import MiddlewareMixin
from django.middleware.csrf import get_token

class MyMiddle(MiddlewareMixin):
   # def process_request(self, request):
     #   get_token(request)

    def process_response(self, request, response):
        if request.method == 'OPTIONS':
            response['Access-Control-Allow-Methods'] = '*,PUT,DELETE'
            response['Access-Control-Allow-Headers'] = 'Content-Type,Cookies'
        response['Access-Control-Allow-Credentials'] = 'true'
        response['Access-Control-Allow-Origin'] = '*'
        return response
